@file:Suppress("unused")

package com.example.demo.model

import xyz.erupt.annotation.Erupt
import xyz.erupt.annotation.EruptField
import xyz.erupt.annotation.sub_field.Edit
import xyz.erupt.annotation.sub_field.EditType
import xyz.erupt.annotation.sub_field.View
import xyz.erupt.annotation.sub_field.sub_edit.*
import xyz.erupt.jpa.model.BaseModel
import java.util.*
import javax.persistence.Entity
import javax.persistence.Table

/*
* Copyright © 2020-2035 erupt.xyz All rights reserved.
* Author: YuePeng (erupts@126.com)
*/

@Erupt(name = "学生管理")
@Table(name = "t_student")
@Entity
class Student : BaseModel() {

    @EruptField(
        views = [View(title = "姓名", sortable = true)],
        edit = Edit(title = "姓名", type = EditType.INPUT, search = Search(), notNull = true, inputType = InputType())
    )
    var name: String = ""

    @EruptField(
        views = [View(title = "年龄", sortable = true)],
        edit = Edit(title = "年龄", type = EditType.NUMBER, search = Search(), notNull = true, numberType = NumberType())
    )
    var age: Int = 0

    @EruptField(
        views = [View(title = "地图")],
        edit = Edit(title = "地图", type = EditType.MAP, search = Search(), notNull = true)
    )
    var map: String = ""

    @EruptField(
        views = [View(title = "生日", sortable = true)],
        edit = Edit(title = "生日", type = EditType.DATE, search = Search(), notNull = true, dateType = DateType())
    )
    var birthday: Date = Date()

    @EruptField(
        views = [View(title = "性别", sortable = true)],
        edit = Edit(title = "性别", type = EditType.BOOLEAN, search = Search(), notNull = true, boolType = BoolType())
    )
    var gender: Boolean = false

}